<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./js/aniamte.js"></script>
    <style>
        #box {
            height: 500px;
            width: 800px;
            border: 2px solid #c0c0c0;

            position: relative;
            margin: 100px auto;
        }

        * {
            margin: 0;
            padding: 0;
        }

        ul {
            list-style: none;
            height: 100%;
            width: 100%;
        }

        ul>li {
            height: 100%;
            width: 100%;
            position: absolute;
            font-size: 30px;
            text-align: center;

            opacity: 0;

        }

        li:nth-child(1) {
            opacity: 1;
        }

        li:nth-child(1) {

            /*background-color: red;*/
        }

        li:nth-child(2) {
            /*background-color: yellow;*/
        }

        li:nth-child(3) {
            /*background-color: green;*/
        }

        li:nth-child(4) {
            /*background-color: #0094ff;*/
        }

        li:nth-child(5) {
            /*background-color: pink;*/
        }

        ol {
            list-style: none;
            width: 100%;
            margin-top: 5px;
        }

        ol>li {
            height: 100px;
            width: 146px;
            margin-left: 8px;
            float: left;
            text-align: center;
            border: 1px solid #999999;
            opacity: .2;
        }

        ol>li img {
            height: 100px;
            width: 146px;
            float: left;
        }
    </style>

</head>

<body>


    <div id="box">
        <ul id="ul">
            <li><a href="javascript:void(0)"><img src="images/slidepic1.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic2.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic3.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic4.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic5.jpg" alt="" /></a></li>
        </ul>

        <ol id="ol">
            <li><a href="javascript:void(0)"><img src="images/slidepic1.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic2.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic3.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic4.jpg" alt="" /></a></li>
            <li><a href="javascript:void(0)"><img src="images/slidepic5.jpg" alt="" /></a></li>
        </ol>
    </div>
</body>

</html>
<script>

    var oBox = document.getElementById('box');

    var oUl = document.getElementById('ul');

    var oOl = document.getElementById('ol');


    var imgIndex = 0;

    function autoPlay() {

        imgIndex++;
        if (imgIndex > 4) {
            imgIndex = 0;
        }

        for (var i = 0; i < oUl.children.length; i++) {
            if (i == imgIndex) {
                utils.animate(oUl.children[i], { "opacity": 1 });

                utils.animate(oOl.children[i], { "opacity": 1 })
            } else {
                utils.animate(oUl.children[i], { "opacity": 0 });
                utils.animate(oOl.children[i], { "opacity": 0.2 })
            }
        }
    }

    var timer = setInterval(function () {
        autoPlay()
    }, 1500)


    for (var i = 0; i < oOl.children.length; i++) {

        oOl.children[i].index = i;
        oOl.children[i].onclick = function () {
            clearInterval(timer);
            imgIndex = this.index - 1;
            autoPlay();
        }
    }


    oBox.onmouseleave = function () {
        timer = setInterval(function () {
            autoPlay()
        }, 1500)
    }

    oBox.onmouseenter = function () {
        clearInterval(timer);
    }

</script>